package org.mebusw.struts.davincicode;

import junit.framework.TestCase;
import junit.framework.Assert;

public class TestCardPool extends TestCase {

	private CardPool op = null;

	public TestCardPool(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		super.setUp();
		op = new CardPool();
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	public void testRandGet_null() {
		op.clear();
		Assert.assertNull(op.randTake());
		
	}

	public void testRandGet_not_null() {
		DavinciCard card;
		
		card = op.randTake();
		Assert.assertNotNull(card);
		Assert.assertEquals(DavinciCard.NO_OWNER, card.getOwner());
		//System.out.println(card.getValue() + card.getCardId());
		Assert.assertEquals(25, op.size());

		card = op.randTake();
		Assert.assertNotNull(card);
		//System.out.println(card.getValue() + card.getCardId());
		Assert.assertEquals(24, op.size());

		card = op.randTake();
		Assert.assertNotNull(card);
		//System.out.println(card.getValue() + card.getCardId());
		Assert.assertEquals(23, op.size());
	}
}
